Imports BusinessLogicLayer
Imports BusinessLogicLayer.BLMain
Imports BusinessLogicLayer.BLException
Imports DataAccessLayer
Imports UniversalLayer
Imports UniversalLayer.ULMain

Friend NotInheritable Class frmDetails

    '' ''RKD
    '' ''Public Enum eActionModes
    '' ''    mNew = 0
    '' ''    mEdit = 1
    '' ''End Enum

    'Dim _BLMain As BLMain
    Dim _BLRegex As BLRegex
    Dim _BLException As BLException
    Dim _BLDisposer As New BLDisposer(Handle)
    Dim _DLMain As DLMain
    Public _DLEntertainment As DLEntertainment
    'Dim _GUIPopulator As GUIPopulator
    Friend iActionMode As UniversalLayer.eActionModes
    Friend iEntertainmentType As eEntertainmentType
    Public bSeen As Boolean = True
    Public sPoster As String = ""
    Public sMuveeDetailsPKey As String
    Private dtSettingsMain As DataTable

    ''' <summary>
    ''' NO COMMENTS
    ''' </summary>
    ''' <param name="sEntertainmentMainPKey">EntertainmentMain.PKey</param>
    ''' <param name="ieActionMode"></param>
    ''' <param name="ieEntertainmentType"></param>
    ''' <remarks></remarks>
    Public Sub New(ByVal sEntertainmentMainPKey As String, ByVal ieActionMode As UniversalLayer.eActionModes, _
       ByVal ieEntertainmentType As eEntertainmentType)
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        iActionMode = ieActionMode
        iEntertainmentType = ieEntertainmentType

        'Dim _GUIPopulator As EntertainmentManager.GUIPopulator ', iActionMode, iEntertainmentType)
        Dim _DLSettings As DLSettings
        Try
            '_GUIPopulator = New EntertainmentManager.GUIPopulator(Me) ', iActionMode, iEntertainmentType)
            '_GUIPopulator.InitializeFormDetails(Me)
            _DLSettings = New DLSettings
            dtSettingsMain = _DLSettings.FetchAllSettings 'CType(_DLSettings.FetchSettings("", "", "", DLSettings.eSettingsReturnType.DataTable), DataTable)
            If Not IsEmpty(sEntertainmentMainPKey) Then sMuveeDetailsPKey = sEntertainmentMainPKey
        Catch ex As Exception
            ThrowBLException(ex, "New EntertainmentManager.frmDetails")
        Finally
            '_GUIPopulator = Nothing
        End Try
    End Sub

    Private Sub frmDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '' ''TODO: This line of code loads data into the 'DsCondition.CondMain' table. You can move, or remove it, as needed.
        ' ''Me.CondMainTableAdapter.Fill(Me.DsCondition.CondMain)
        '' ''TODO: This line of code loads data into the 'DsCondition.CondMain' table. You can move, or remove it, as needed.
        ' ''Me.CondMainTableAdapter.Fill(Me.DsCondition.CondMain)
        '' ''TODO: This line of code loads data into the 'dsCondition.CondMain' table. You can move, or remove it, as needed.
        ' ''Me.CondMainTableAdapter.Fill(Me.dsCondition.CondMain)
        '' ''TODO: This line of code loads data into the 'dsMuvee.MuveeMain' table. You can move, or remove it, as needed.
        ' ''Me.MuveeMainTableAdapter.Fill(Me.dsMuvee.MuveeMain)
        '' ''TODO: This line of code loads data into the 'dsVolume.VolumeMain' table. You can move, or remove it, as needed.
        ' ''Me.VolumeMainTableAdapter.Fill(Me.dsVolume.VolumeMain)
        '' ''TODO: This line of code loads data into the 'dsLayer.LayerMain' table. You can move, or remove it, as needed.
        ' ''Me.LayerMainTableAdapter.Fill(Me.dsLayer.LayerMain)
        '' ''TODO: This line of code loads data into the 'dsRegion.RegionMain' table. You can move, or remove it, as needed.
        ' ''Me.RegionMainTableAdapter.Fill(Me.dsRegion.RegionMain)
        '' ''TODO: This line of code loads data into the 'dsVCodec.VCodecMain' table. You can move, or remove it, as needed.
        ' ''Me.VCodecMainTableAdapter.Fill(Me.dsVCodec.VCodecMain)
        '' ''TODO: This line of code loads data into the 'dsMedium.MediumMain' table. You can move, or remove it, as needed.
        ' ''Me.MediumMainTableAdapter.Fill(Me.dsMedium.MediumMain)
        '' ''TODO: This line of code loads data into the 'dsColour.ColourMain' table. You can move, or remove it, as needed.
        ' ''Me.ColourMainTableAdapter.Fill(Me.dsColour.ColourMain)

        'Dim _DLReader As New DLReader
        '_GUIPopulator.FillDetailsCombos(Me)
        'numReleaseYear.Minimum = BLMain.eReleaseYear.yMinimum
        'numReleaseYear.Maximum = BLMain.eReleaseYear.yMaximum
        'numReleaseYear.Value = BLMain.eReleaseYear.yDefault
        'numNDiscs.Minimum = BLMain.eNumDiscs.nMinimum
        'numNDiscs.Maximum = BLMain.eNumDiscs.nMaximum
        'numNDiscs.Value = BLMain.eNumDiscs.nDefault

        Dim _GUIPopulator As EntertainmentManager.GUIPopulator ', iActionMode, iEntertainmentType)
        Try
            _GUIPopulator = New EntertainmentManager.GUIPopulator(Me) ', iActionMode, iEntertainmentType)
            _GUIPopulator.InitializeFormDetails(Me)
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.frmDetails_Load")
            Me.Close()
        Finally
            _GUIPopulator = Nothing
        End Try

        ''If iActionMode = BLMain.eActionModes.mNew Then

        ''    'Movie Info Tab
        ''    txtTitle.Text = ""
        ''    txtAltTitle.Text = ""
        ''    mskRatingImdb.Text = "0.0"
        ''    sliderRatingCustom.Value = 0
        ''    'picPoster.ImageLocation = ""
        ''    'picPoster.Image = "" 

        ''    'Main Details Tab
        ''    numNumber.Value = _DLReader.FetchLastSerial()
        ''    numReleaseYear.Value = BLMain.eReleaseYear.yDefault
        ''    chkSeen.Checked = False
        ''    numRuntime.Value = 0

        ''    txtDirector.Text = ""
        ''    txtCountry.Text = ""
        ''    txtGenre.Text = ""
        ''    txtClassification.Text = ""
        ''    txtStudio.Text = ""

        ''    txtLinkOfficial.Text = ""
        ''    txtLinkIMDb.Text = ""
        ''    txtLinkWiki.Text = ""
        ''    txtLinkTrailer.Text = ""

        ''    'Technical Info Tab
        ''    cmbMedium.SelectedIndex = CInt(IIf(cmbMedium.Items.Count = 0, -1, 0))
        ''    numNDiscs.Value = BLMain.eNumDiscs.nDefault
        ''    cmbCondition.SelectedIndex = CInt(IIf(cmbCondition.Items.Count = 0, -1, 0))
        ''    cmbDvdRegion.SelectedIndex = CInt(IIf(cmbDvdRegion.Items.Count = 0, -1, 0))
        ''    cmbDvdLayer.SelectedIndex = CInt(IIf(cmbDvdLayer.Items.Count = 0, -1, 0))
        ''    cmbVolume.SelectedIndex = CInt(IIf(cmbVolume.Items.Count = 0, -1, 0))
        ''    cmbCollection.SelectedIndex = CInt(IIf(cmbCollection.Items.Count = 0, -1, 0))
        ''    cmbColour.SelectedIndex = CInt(IIf(cmbColour.Items.Count = 0, -1, 0))
        ''    cmbVCodec.SelectedIndex = CInt(IIf(cmbVCodec.Items.Count = 0, -1, 0))

        ''    'Languages Tab

        ''    'Plot/Cast/Notes Tab
        ''    txtPlot.Text = ""
        ''    txtCast.Text = ""
        ''    txtNotes.Text = ""

        ''ElseIf iActionMode = BLMain.eActionModes.mEdit Then

        ''    With _DLEntertainment
        ''        'Movie Info Tab
        ''        txtTitle.Text = .TITLE
        ''        txtAltTitle.Text = .ALT_TITLE
        ''        'sliderRatingIMDb.Value = CInt(.RATING_IMDB * 10)
        ''        mskRatingImdb.Text = (.RATING_IMDB * 10).ToString
        ''        sliderRatingCustom.Value = .RATING_CUSTOM

        ''        'Main Details Tab
        ''        picPoster.ImageLocation = .POSTER_LOC 'format to take only file name
        ''        '.POSTER = ""
        ''        numNumber.Value = .SERIAL_NO
        ''        numReleaseYear.Value = .RELEASE_YEAR
        ''        chkSeen.Checked = .SEEN
        ''        numRuntime.Value = .RUN_TIME

        ''        txtDirector.Text = .DIRECTOR
        ''        txtCountry.Text = .COUNTRY
        ''        txtGenre.Text = .GENRE
        ''        txtClassification.Text = .CLASSIFICATION
        ''        txtStudio.Text = .STUDIO

        ''        txtLinkOfficial.Text = .LINK_OFFICIAL
        ''        txtLinkIMDb.Text = .LINK_IMDB
        ''        txtLinkWiki.Text = .LINK_WIKI
        ''        txtLinkTrailer.Text = .LINK_TRAILER

        ''        'Technical Info Tab
        ''        cmbMedium.Text = .MEDIUM
        ''        numNDiscs.Value = .nDISCs
        ''        cmbCondition.Text = .CONDITION
        ''        cmbDvdRegion.Text = .DVD_REGION
        ''        cmbDvdLayer.Text = .DVD_LAYER
        ''        cmbVolume.Text = .VOLUME
        ''        cmbCollection.Text = .COLLECTION
        ''        cmbColour.Text = .COLOUR
        ''        cmbVCodec.Text = .V_CODEC

        ''        'Languages Tab

        ''        'Plot/Cast/Notes Tab
        ''        txtPlot.Text = .PLOT
        ''        txtCast.Text = .CAST
        ''        txtNotes.Text = .NOTES

        ''        '' ''rename all controls
        ''        '' ''small_scroll for number_up_dwn controls: 3 --> 1
        ''        '' ''copy poster to directory POSTERS, replace " " with "_"
        ''    End With

        ''End If

    End Sub

#Region "Operations"

    Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
        Me.Refresh()
    End Sub

    Private Sub btnDiscard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDiscard.Click
        Me.Close()
        'End
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim _DLWriter As DLWriter
        Dim _BLMain As BusinessLogicLayer.BLMain
        Try
            _DLWriter = New DLWriter("frmDetails")
            _BLMain = New BusinessLogicLayer.BLMain(BLMain.eInitMode.Actions)
            'iActionMode = BLMain.eActionModes.mEdit

            'set properties from fields
            With _DLEntertainment
                'Movie Info Tab
                .cTitle = txtTitle.Text
                .cAlternateTitle = txtAltTitle.Text
                .cRatingIMDb = sliderRatingIMDb.Value / 10
                .cRatingCustom = sliderRatingCustom.Value

                'Main Details Tab
                .cPosterLocation = picPoster.ImageLocation 'format to take only file name
                '.POSTER=""
                .cSerialNo = CInt(numNumber.Value)
                .cReleaseYear = CInt(numReleaseYear.Value)
                .cSeen = chkSeen.Checked
                .cRunTimeMins = CInt(numRuntime.Value)

                .cDirector = txtDirector.Text
                .cCountry = txtCountry.Text
                .cGenre = txtGenre.Text
                .cClassification = txtClassification.Text
                .cStudio = txtStudio.Text

                .cLinkOfficial = txtLinkOfficial.Text
                .cLinkIMDb = txtLinkIMDb.Text
                .cLinkWikipedia = txtLinkWiki.Text
                .cLinkTrailer = txtLinkTrailer.Text

                'Technical Info Tab
                .cNDiscs = CInt(numNDiscs.Value)
                .cMediumPKey = CInt(cmbMedium.ValueMember)
                .cConditionPKey = CInt(cmbCondition.ValueMember)
                .cDVDRegionPKey = CInt(cmbDvdRegion.ValueMember)
                .cDVDLayerPKey = CInt(cmbDvdLayer.ValueMember)
                .cVolumePKey = CInt(cmbVolume.ValueMember)
                .cCollectionPKey = CInt(cmbCollection.ValueMember)
                .cColourPKey = CInt(cmbColour.ValueMember)
                .cVCodecPKey = CInt(cmbVCodec.ValueMember)

                'Languages Tab

                'Plot/Cast/Notes Tab
                .cPlot = txtPlot.Text
                .cCasting = txtCast.Text
                .cNotes = txtNotes.Text

                '' ''rename all controls
                '' ''small_scroll for number_up_dwn controls: 3 --> 1
                '' ''copy poster to directory POSTERS, replace " " with "_"
            End With

            If iActionMode = UniversalLayer.eActionModes.mNew Then
                If _BLMain.Validate(_DLEntertainment) Then _DLWriter.AddNew(_DLEntertainment)
            ElseIf iActionMode = UniversalLayer.eActionModes.mEdit Then
                If _BLMain.Validate(_DLEntertainment) Then _DLWriter.Save(_DLEntertainment)
            End If

            _BLDisposer.component = Me
            _BLDisposer.Dispose()
            Me.Close()
            Me.Dispose()

        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.btnSave_Click")
        Finally
            _BLMain = Nothing
            _DLWriter = Nothing
        End Try
    End Sub

#End Region

    Private Sub frmDetails_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        'btnCancel_Click(sender, e)
    End Sub

    Private Sub chkSeen_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkSeen.CheckedChanged
        'select case 

        If bSeen Then
            picEye.ImageLocation = Application.StartupPath & "\img\seen.png"
        Else
            picEye.ImageLocation = Application.StartupPath & "\img\unseen.png"
        End If

        bSeen = Not bSeen
    End Sub

    ''' <summary>
    ''' Left-click: preview poster
    ''' Right-click: Browse for Movie Poster
    ''' </summary>
    Private Sub picPoster_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picPoster.MouseDown
        Select Case e.Button
            Case Windows.Forms.MouseButtons.Left
                Dim _frmPoster As EntertainmentManager.frmPoster
                Try
                    _frmPoster = New EntertainmentManager.frmPoster
                    _frmPoster.picPoster.Image = picPoster.Image
                    _frmPoster.StartPosition = FormStartPosition.CenterScreen
                    _frmPoster.ShowDialog(Me)
                    _frmPoster.Dispose()

                Catch ex As Exception
                    ThrowBLException(ex, "EntertainmentManager.frmDetails.picPoster_MouseDown")
                Finally
                    _frmPoster = Nothing
                End Try

            Case Windows.Forms.MouseButtons.Right
                Dim sPathPoster As String = ""
                'Dim _DLSettings As DLSettings
                Dim sInitialDirectory As String '= DLSettings.FetchOneSetting(dtSettingsMain, "Poster", "Browse", "").ToString
                Dim sExtension As String '= DLSettings.FetchOneSetting(dtSettingsMain, "Poster", "Extension", "").ToString

                Try
                    '_DLSettings = New DLSettings
                    sInitialDirectory = DLSettings.FetchOneSetting(dtSettingsMain, "Poster", "Browse", "").ToString
                    sExtension = DLSettings.FetchOneSetting(dtSettingsMain, "Poster", "Extension", "").ToString

                    browsePoster.ShowDialog(Me)
                    'sPathPoster = browsePoster.SelectedPath
                    openPoster.DefaultExt = IIf(Not IsEmpty(sExtension), sExtension, "jpg").ToString
                    openPoster.Multiselect = False
                    openPoster.FileName = txtTitle.Text.Replace(" ", "_")
                    openPoster.CheckFileExists = True
                    openPoster.InitialDirectory = IIf(Not IsEmpty(sInitialDirectory) And IsDirectoryExists(sInitialDirectory), sInitialDirectory, Application.StartupPath).ToString '"P:\[wallps]\posters"
                    openPoster.Filter = "Image files (*.jpg)|*." & IIf(Not IsEmpty(sExtension), sExtension, "jpg").ToString
                    openPoster.ShowDialog(Me)
                    sPathPoster = openPoster.FileName
                    'sPoster = openPoster.SafeFileName

                    If IsFileExists(sPathPoster) Then picPoster.ImageLocation = sPathPoster

                Catch ex As Exception
                    ThrowBLException(ex, "EntertainmentManager.frmDetails.picPoster_MouseDown")
                Finally
                    sPathPoster = Nothing
                    '_DLSettings = Nothing
                    sInitialDirectory = Nothing
                    sExtension = Nothing
                End Try
        End Select
    End Sub

    Private Sub sliderRatingIMDb_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles sliderRatingIMDb.MouseUp

    End Sub

    Private Sub sliderRatingIMDb_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles sliderRatingIMDb.MouseWheel
        'e.Delta.MinValue = 0
    End Sub

    Private Sub sliderRatingIMDb_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sliderRatingIMDb.Scroll
        'mskRatingImdb.Text = sliderRatingIMDb.Value.ToString
    End Sub

    Private Sub sliderRatingCustom_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles sliderRatingCustom.MouseHover
        sliderRatingCustom.Focus()
    End Sub

    Private Sub sliderRatingCustom_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sliderRatingCustom.Scroll
        'lblRatingCustom.Text = sliderRatingCustom.Value.ToString
    End Sub

    Private Sub sliderRatingCustom_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles sliderRatingCustom.ValueChanged
        lblRatingCustom.Text = sliderRatingCustom.Value.ToString
    End Sub

    Private Sub mskRatingImdb_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mskRatingImdb.TextChanged
        Dim sRating As String = mskRatingImdb.Text

        Try
            'sliderRatingIMDb.Value = CInt(Math.Round(CDbl(IIf(Not IsNumeric(sRating), 0, sRating)), 0))
            sliderRatingIMDb.Value = CInt(CDbl(IIf(Not IsNumeric(sRating), 0, sRating)) * 10)
        Catch ex As ArgumentOutOfRangeException
            mskRatingImdb.Text = "0.0"
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.mskRatingImdb_TextChanged")
        End Try
    End Sub

    'Private Sub Volume_nDeltToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    '    Try
    '        Me.VolumeMainTableAdapter.Volume_nDelt(Me.dsVolume.VolumeMain)
    '    Catch ex As System.Exception
    '        System.Windows.Forms.MessageBox.Show(ex.Message)
    '    End Try

    'End Sub

    Private Sub txtTitle_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTitle.TextChanged
        Me.Text = "Details: " & txtTitle.Text
    End Sub

    Private Sub chkCopyTitle_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkCopyTitle.CheckedChanged
        txtAltTitle.Text = txtTitle.Text
    End Sub

    Private Sub lblRatingCustom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblRatingCustom.Click

    End Sub

#Region "Links"

    Private Sub lnkOfficialSite_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkOfficial.LinkClicked
        System.Diagnostics.Process.Start(txtLinkOfficial.Text)
    End Sub

    Private Sub lnkLINK_IMDBClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkIMDb.LinkClicked
        System.Diagnostics.Process.Start(txtLinkIMDb.Text)
    End Sub

    Private Sub lnkLINK_WIKIClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkWiki.LinkClicked
        System.Diagnostics.Process.Start(txtLinkWiki.Text)
    End Sub

    Private Sub lnkTrailer_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkTrailer.LinkClicked
        System.Diagnostics.Process.Start(txtLinkTrailer.Text)
    End Sub

#End Region

#Region "Clear/Add entered data"

#Region "Main Details tab"

    Private Sub btnBrowseDirector_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseDirector.Click
        frmMultiSelector.ShowDialog(Me)
    End Sub

    Private Sub btnBrowseCountry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseCountry.Click
        frmMultiSelector.ShowDialog(Me)
    End Sub

    Private Sub btnBrowseGenre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseGenre.Click
        frmMultiSelector.ShowDialog(Me)
    End Sub

    Private Sub cmbDirector_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbDirector.TextChanged
        'Dim sKeyword As String = cmbDirector.Text

        'If Not IsEmpty(sKeyword) Then
        '    Dim dtPeople As New DataTable
        '    Dim sSQL As String
        '    _DLMain = New DLMain

        '    sSQL = "SELECT PKey, Name FROM PeopleMain WHERE Status<>'d' AND Name like '" & sKeyword & "%'"
        '    _DLMain.ExecuteSQL(sSQL, dtPeople, "People")
        '    cmbDirector.DataSource = dtPeople
        '    cmbDirector.DisplayMember = "Name"
        '    cmbDirector.ValueMember = "PKey"
        '    cmbDirector.SelectedIndex = -1

        '    dtPeople = Nothing
        '    sSQL = Nothing
        '    _DLMain = Nothing
        'Else
        '    _GUIPopulator.FillComboBox(cmbDirector, eModules.Director, False)
        'End If
        'sKeyword = Nothing
    End Sub

    Private Sub btnClearDirector_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearDirector.Click
        txtDirector.Text = ""
        cmbDirector.SelectedIndex = -1
    End Sub

    Private Sub btnClearCountry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearCountry.Click
        txtCountry.Text = ""
    End Sub

    Private Sub btnClearGenre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearGenre.Click
        txtGenre.Text = ""
    End Sub

    Private Sub btnClearClassification_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearClassification.Click
        txtClassification.Text = ""
    End Sub

    Private Sub btnClearStudio_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearStudio.Click
        txtStudio.Text = ""
    End Sub

    Private Sub btnClearLinkOfficial_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearLinkOfficial.Click
        txtLinkOfficial.Text = ""
    End Sub

    Private Sub btnClearLinkIMDb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearLinkIMDb.Click
        txtLinkIMDb.Text = ""
    End Sub

    Private Sub btnClearLinkWiki_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearLinkWiki.Click
        txtLinkWiki.Text = ""
    End Sub

    Private Sub btnClearLinkTrailer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearLinkTrailer.Click
        txtLinkTrailer.Text = ""
    End Sub

    Private Sub txtLinkOfficial_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLinkOfficial.TextChanged
        Dim sLinkOfficial As String = txtLinkOfficial.Text

        Try
            lnkOfficial.Visible = Not Equals(sLinkOfficial.Trim, "")
            If lnkOfficial.Visible Then lnkOfficial.Enabled = _BLRegex.RegexValidator(BLRegex.eFormat.eURL, sLinkOfficial)
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.txtLinkOfficial_TextChanged")
        Finally
            sLinkOfficial = Nothing
        End Try
    End Sub

    Private Sub txtLinkIMDb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLinkIMDb.TextChanged
        Dim sLinkIMDb As String = txtLinkIMDb.Text

        Try
            lnkIMDb.Visible = Not Equals(sLinkIMDb.Trim, "")
            If lnkIMDb.Visible Then lnkIMDb.Enabled = _BLRegex.RegexValidator(BLRegex.eFormat.eURL, sLinkIMDb)
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.txtLinkIMDb_TextChanged")
        Finally
            sLinkIMDb = Nothing
        End Try
    End Sub

    Private Sub txtLinkWiki_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLinkWiki.TextChanged
        Dim sLinkWiki As String = txtLinkWiki.Text

        Try
            lnkWiki.Visible = Not Equals(sLinkWiki.Trim, "")
            If lnkWiki.Visible Then lnkWiki.Enabled = _BLRegex.RegexValidator(BLRegex.eFormat.eURL, sLinkWiki)
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.txtLinkWiki_TextChanged")
        Finally
            sLinkWiki = Nothing
        End Try
    End Sub

    Private Sub txtLinkTrailer_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLinkTrailer.TextChanged
        Dim sLinkTrailer As String = txtLinkTrailer.Text
        'Dim bTest As Boolean = Equals(sLinkTrailer.Trim, "") '_BLRegex.RegexValidator(BLRegex.eFormat.eURL, sLinkTrailer)

        Try
            lnkTrailer.Visible = Not Equals(txtLinkTrailer.Text.Trim, "")
            If lnkTrailer.Visible Then lnkTrailer.Enabled = _BLRegex.RegexValidator(BLRegex.eFormat.eURL, sLinkTrailer)
        Catch ex As Exception
            ThrowBLException(ex, "EntertainmentManager.frmDetails.txtLinkTrailer_TextChanged")
        Finally
            sLinkTrailer = Nothing
        End Try
    End Sub

#End Region

#Region "Technical Info tab"

    Private Sub btnClearMedium_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearMedium.Click
        cmbMedium.SelectedIndex = -1
    End Sub

    Private Sub btnClearCondition_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearCondition.Click
        cmbCondition.SelectedIndex = -1
    End Sub

    Private Sub btnClearDvdRegion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearDvdRegion.Click
        cmbDvdRegion.SelectedIndex = -1
    End Sub

    Private Sub btnClearDvdLayer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearDvdLayer.Click
        cmbDvdLayer.SelectedIndex = -1
    End Sub

    Private Sub btnClearVolume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearVolume.Click
        cmbVolume.SelectedIndex = -1
    End Sub

    Private Sub btnClearCollection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearCollection.Click
        cmbCollection.SelectedIndex = -1
    End Sub

    Private Sub btnClearColour_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearColour.Click
        cmbColour.SelectedIndex = -1
    End Sub

    Private Sub btnClearVCodec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearVCodec.Click
        cmbVCodec.SelectedIndex = -1
    End Sub

    Private Sub btnAddVolume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddVolume.Click

    End Sub

    Private Sub btnAddCollection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddCollection.Click

    End Sub

#End Region

#Region "Language tab"

#End Region

#Region "Plot/Cast/Notes tab"

    Private Sub btnClearPlot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearPlot.Click
        txtPlot.Text = ""
    End Sub

    Private Sub btnClearCast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearCast.Click
        txtCast.Text = ""
    End Sub

    Private Sub btnClearNotes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearNotes.Click
        txtNotes.Text = ""
    End Sub

#End Region

#End Region











    Private Sub radSeason_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radSeason.CheckedChanged
        lblInstruction.Text = "Enter details of TV Series"
        cmbSeriesParent.Enabled = False
        numSeason.Enabled = False
        numEpisode.Enabled = False
    End Sub

    Private Sub radEpisode_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radEpisode.CheckedChanged
        lblInstruction.Text = "Enter details of TV Series" & vbCrLf & "(Episode)"
        cmbSeriesParent.Enabled = True
        numSeason.Enabled = True
        numEpisode.Enabled = True
    End Sub
End Class